{% extends "oj_base.html" %}
{% block title %}
用户设置
{% endblock %}
{% block body %}
<div class="container main">

    <div class="col-lg-2">
        <ul class="list-group">
            <li class="list-group-header">通用设置</li>
            <li class="list-group-item active"><a href="/account/settings/">个人信息</a></li>
            <li class="list-group-item"><a href="/account/settings/avatar/">更换头像</a></li>
            <li class="list-group-item"><a href="/two_factor_auth/">两步验证</a></li>
            <li class="list-group-item"><a href="/change_password/">修改密码</a></li>
        </ul>
    </div>
    <div class="col-lg-3">
        <img src="{{ user.userprofile.avatar }}" class="img-responsive big-avatar">
    </div>
    <div class="col-lg-6">
        <form>
            <div class="row">
                <div class="form-group col-md-6"><label>用户名</label>
                    <input name="username" type="text" class="form-control"
                           value="{{ request.user.username }}" readonly>
                </div>
                <div class="form-group col-md-6"><label>真实姓名</label>
                    <input name="real_name" type="text" class="form-control"
                           value="{{ request.user.real_name }}" readonly>
                </div>
            </div>
            <div class="row">
                <div class="form-group col-md-6"><label>电子邮箱</label>
                    <input name="email" type="email" class="form-control"
                           value="{{ request.user.email }}" readonly>
                </div>
                <div class="form-group col-md-6"><label>手机</label>
                    <input name="phone_number" type="text" maxlength="11" id="phone"
                           class="form-control"
                           value="{% if request.user.userprofile.phone_number %}{{ request.user.userprofile.phone_number }}{% endif %}">
                </div>
                <div class="help-block with-errors"></div>
            </div>
            <div class="row">
                <div class="form-group col-md-6">
                    <label>学校</label>
                    <input name="school" type="text" class="form-control" id="school"
                           value="{% if request.user.userprofile.school %}{{ request.user.userprofile.school }}{% endif %}">

                    <div class="help-block with-errors"></div>
                </div>
                <div class="form-group col-md-6">
                    <label>hduoj 用户名</label>
                    <input name="hduoj_username" type="text" class="form-control" id="hduoj_username"
                           value="{% if request.user.userprofile.hduoj_username %}{{ request.user.userprofile.hduoj_username }}{% endif %}">

                    <div class="help-block with-errors"></div>
                </div>
                <div class="form-group col-md-6">
                    <label>BestCoder 用户名</label>
                    <input name="bestcoder_username" type="text" class="form-control" id="bestcoder_username"
                           value="{% if request.user.userprofile.bestcoder_username %}{{ request.user.userprofile.bestcoder_username }}{% endif %}">

                    <div class="help-block with-errors"></div>
                </div>
                <div class="form-group col-md-6">
                    <label>Codeforces 用户名</label>
                    <input name="codeforces_username" type="text" class="form-control" id="codeforces_username"
                           value="{% if request.user.userprofile.codeforce_username %}{{ request.user.userprofile.codeforces_username }}{% endif %}">

                    <div class="help-block with-errors"></div>
                </div>
                <div class="form-group col-md-12"><label>学号</label>
                    <input name="student_id" type="number" class="form-control" id="student_id"
                           value="{% if request.user.userprofile.student_id %}{{ request.user.userprofile.student_id }}{% endif %}">

                    <div class="help-block with-errors"></div>

                </div>
                <div class="form-group col-md-12"><label>blog</label>
                    <input name="blog" type="url" class="form-control" id="blog"
                           value="{% if request.user.userprofile.blog %}{{ request.user.userprofile.blog }}{% endif %}">

                    <div class="help-block with-errors"></div>

                </div>
                <div class="form-group col-md-12">
                    <label>签名</label>
                    <input name="mood" type="text" maxlength="60" class="form-control" id="mood"
                           value="{% if request.user.userprofile.mood %}{{ request.user.userprofile.mood }}{% endif %}"
                           data-error="字数限制在30字以内">

                    <div class="help-block with-errors"></div>
                </div>
                <div class="form-group col-md-12">
                    <label>OpenAPI Appkey(<a href="https://github.com/QingdaoU/OnlineJudgeOpenAPI" target="_blank">如何使用?</a>)</label>
                    <input type="text" class="form-control"
                           value="{% if request.user.openapi_appkey %}{{ request.user.openapi_appkey }}{% else %}功能未开启 请联系管理员{% endif %}" readonly>
                </div>

                <div class="form-group">
                    <button type="submit" class="btn btn-primary">提交</button>
                </div>
            </div>
        </form>
    </div>
</div>
{% endblock %}

{% block js_block %}
<script src="/static/js/app/oj/account/settings.js"></script>
{% endblock %}
